﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Helpers;

namespace III.Web.SaleDemo
{
    public static class DebugHelper
    {

        public static string LogFilePath = System.Web.HttpContext.Current.Server.MapPath("~/Log/log.txt");



        public static void Info(string message)
        {
            //mesageList.Add(message);
            lock (message)
            {
                if (!System.IO.File.Exists(LogFilePath))
                {
                    System.IO.File.Create(LogFilePath);
                }
                System.IO.File.AppendAllText(LogFilePath, string.Format("\r\n{0:yyyy-MM-dd HH:mm:ss}\t{1}", DateTime.Now, message));
            }
        }
        public static void Info(HttpRequestBase request, string message)
        {
            //mesageList.Add(message);
            lock (message)
            {
                var method = request.HttpMethod;
                var url = request.Url;
                System.IO.File.AppendAllText(LogFilePath, string.Format("\r\n{0:yyyy-MM-dd HH:mm:ss}\t{1}\t{2}\t{3}", DateTime.Now, message, method, url));
            }
        }

    }
}